package sunbao.ido.proxy;

import java.io.Serializable;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * \* User: MeiZhongHao
 * \* Date: 2018-10-22
 * \* Time: 15:03
 * \* Description:
 * \
 */
public class IDoProxy<T> implements InvocationHandler, Serializable {

    private final Class<T> mapperInterface;

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        if ("doPrint".equals(method.getName())) {
            return "hello";
        } else if ("la".equals(method.getName())) {
            return "la";
        }
        throw new Exception("没有方法实现");
    }

    public IDoProxy(Class<T> mapperInterface) {
        this.mapperInterface = mapperInterface;
    }
}